import * as userApi from '../../../api/user.js'

const state = {
	userId: 1,
	phone: '',
	vip: {
		name: 'test',
		discount: 0.85
	},
	unReadMessage: 2
}

const getters = {

}

const actions = {
	async getUserInfo({
		commit,
		state
	}) {
		commit('setUserInfo', await userApi.getUserInfo())
	}
}

const mutations = {
	setUserInfo(state, userinfo) {
		Object.assign(state, userinfo)
	}
}

export default {
	namespaced: true,
	state,
	getters,
	mutations,
	actions
}
